Skip to content

Add support for CURLINFO_QUEUE_TIME_T in curl_getinfo() #19147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 17, 2025

Conversation

thecaliskan
Copy link
Contributor

Add support for CURLINFO_QUEUE_TIME_T in curl_getinfo()

Summary

This patch adds support for the CURLINFO_QUEUE_TIME_T constant in the curl_getinfo() function when compiled with libcurl >= 8.6.0.

CURLINFO_QUEUE_TIME_T This constant allows retrieving the time (in microseconds) that the request spent in libcurl’s connection queue before it was sent.
Source


Details

  • Introduced support for curl_getinfo($ch, CURLINFO_QUEUE_TIME_T) when available.
  • Added "queue_time_us" key to the associative array returned by curl_getinfo($ch) if applicable.
  • A SKIPIF check ensures that the test is skipped if the libcurl version is too old.
  • Includes a .phpt test file: ext/curl/tests/curl_getinfo_CURLINFO_QUEUE_TIME_T.phpt.

Requirements

  • Requires libcurl version 8.6.0 or higher.
  • PHP runtime will fallback silently if the constant is not available in the underlying libcurl.

Example usage

$ch = curl_init("https://example.com");
curl_exec($ch);
$queueTime = curl_getinfo($ch, CURLINFO_QUEUE_TIME_T);
echo "Queue Time: $queueTime\n";

CURL Times

An overview of the time values available from curl_easy_getinfo

curl_easy_perform()
|
|--QUEUE
|--|--NAMELOOKUP
|--|--|--CONNECT
|--|--|--|--APPCONNECT
|--|--|--|--|--PRETRANSFER
|--|--|--|--|--|--POSTTRANSFER
|--|--|--|--|--|--|--STARTTRANSFER
|--|--|--|--|--|--|--|--TOTAL
|--|--|--|--|--|--|--|--REDIRECT

Copy link
Member

@Ayesh Ayesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @thecaliskan @devnexen. Looks good!

CURLINFO_QUEUE_TIME_T is the last TIME Curl-info const we did not have in ext/curl. I'm glad we are closing this gap.

@thecaliskan
Copy link
Contributor Author

Hi @bukka

Could you check this PR ?

@bukka bukka merged commit 7fb6afb into php:master Jul 17, 2025
8 of 9 checks passed
@bukka
Copy link
Member

bukka commented Jul 17, 2025

Thanks for the contribution! For the record the NEWS updated in a8a3c81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants